//
//  ALCountSeftyController.m
//  Ummy.G
//
//  Created by 安林 on 16/10/6.
//  Copyright © 2016年 安林. All rights reserved.
//

#import "ALCountSeftyController.h"
#import "ALCountSafetyCell.h"
#import "UIBarButtonItem+buttonItem.h"


@interface ALCountSeftyController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong) UITableView * tableView;
@property (nonatomic,strong)NSArray *leftArr;
@property (nonatomic,strong)NSArray *rightArr;

@end

@implementation ALCountSeftyController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self addItem];
    
    self.tableView = [[UITableView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
    //取消tableView的分割线
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    
    [self.view addSubview:self.tableView];
    
    _leftArr=@[@"账户安全",@"绑定手机",@"社交账号绑定",@"登陆密码",@"密保问题"];
    _rightArr=@[@"风险等级",@"151*****6195",@"绑定/解绑",@"修改",@"未设置"];

}

- (void)addItem{
    
    //------返回---------
    UIBarButtonItem *backR = [UIBarButtonItem barButtonItemWith:[UIButton buttonWithType:UIButtonTypeCustom] addTarget:self action:@selector(backRight) andImage:@"navigationButtonReturn" andHighlighted:nil];
    
    self.navigationItem.leftBarButtonItem =backR;
}



- (void)backRight{
    //没有push的时候用这个
    //[self dismissViewControllerAnimated:YES completion:nil];
    
    //push后，用这个返回
    [self.navigationController popToRootViewControllerAnimated:YES];
}

#pragma mark 返回多少行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}

#pragma mark 返回cell
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * ID = @"countSafety";
    ALCountSafetyCell * cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [ALCountSafetyCell loadALCountSafetyCell];
    }
    cell.leftLabel.text = self.leftArr[indexPath.row];
    cell.rightLabel.text = self.rightArr[indexPath.row];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    return cell;
}

#pragma mark 自定义cell的行高
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}


@end
